package com.learn.order.web;

import com.learn.order.entity.OrderTbl;
import com.learn.order.service.IOrderTblService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *   前端控制器
 * </p>
 *
 * @author zhaofa
 * @since 2019-11-12
 */
@RestController
public class OrderTblController {
    @Autowired
    private IOrderTblService orderTblService;
    @GetMapping(value = "/create")
    @GlobalTransactional(timeoutMills = 300000, name = "spring-cloud-demo-tx")
    public Boolean create(String userId, String commodityCode, Integer count) {
        orderTblService.create(userId,commodityCode,count);
        return true;
    }
	
}
